package sj;

import entity.Person;

import java.lang.reflect.Field;

public class demo2 {
    public static void main(String[] args) throws InstantiationException, IllegalAccessException, NoSuchFieldException {
        Class clz= Person.class;
        Object person=clz.newInstance();

        Field name=clz.getDeclaredField("name");

        name.setAccessible(true);

        name.set(person,"1412");

        System.out.println("赋值后："+name.get(person));
    }
}
